package mainstests;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.List;

import services.XMLService;
import services.impl.XMLServiceBean;
import entities.ItemListaPrecios;
import entities.ListaPrecios;

public class PruebaLecturaListadosDePrecioXML {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		XMLService exchangeFormatService = new XMLServiceBean();
		StringBuffer res = new StringBuffer();
		BufferedReader reader;
			reader = new BufferedReader(new FileReader("xmlProveedoresCasaCentral.xml"));
		String line = reader.readLine();
		while(line!=null){
			res.append(line+"\n");
			line = reader.readLine();
		}	
		reader.close();
		String xml = res.toString();
		List<ListaPrecios> listasPrecios = exchangeFormatService.getListasDePrecios(xml);
		for(ListaPrecios listaPrecio : listasPrecios){
			List<ItemListaPrecios> itemsListaPrecio = listaPrecio.getItems();
//			for(ItemListaPrecios itemListaPrecio : itemsListaPrecio){
//				rodamientoService.persist(itemListaPrecio.getRodamiento());
//			}
		}
	}

}
